package com.example.healthcondition.entity;

import java.time.LocalDate;

public class DietPlans {
    private Integer plan_id;
    private Integer user_id;
    private String plan_name;
    private LocalDate start_date;
    private LocalDate end_date;
    private Integer daily_calories;
    private String description;

    // 默认构造函数
    public DietPlans() {
    }

    // 带所有属性的构造函数
    public DietPlans(Integer plan_id, Integer user_id, String plan_name, LocalDate start_date, LocalDate end_date, Integer daily_calories, String description) {
        this.plan_id = plan_id;
        this.user_id = user_id;
        this.plan_name = plan_name;
        this.start_date = start_date;
        this.end_date = end_date;
        this.daily_calories = daily_calories;
        this.description = description;
    }

    // Getter和Setter方法
    public Integer getPlanId() {
        return plan_id;
    }

    public void setPlanId(Integer plan_id) {
        this.plan_id = plan_id;
    }

    public Integer getUserId() {
        return user_id;
    }

    public void setUserId(Integer user_id) {
        this.user_id = user_id;
    }

    public String getPlanName() {
        return plan_name;
    }

    public void setPlanName(String plan_name) {
        this.plan_name = plan_name;
    }

    public LocalDate getStartDate() {
        return start_date;
    }

    public void setStartDate(LocalDate start_date) {
        this.start_date = start_date;
    }

    public LocalDate getEndDate() {
        return end_date;
    }

    public void setEndDate(LocalDate end_date) {
        this.end_date = end_date;
    }

    public Integer getDailyCalories() {
        return daily_calories;
    }

    public void setDailyCalories(Integer daily_calories) {
        this.daily_calories = daily_calories;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    // toString方法
    @Override
    public String toString() {
        return "DietPlans{" +
                "plan_id=" + plan_id +
                ", user_id=" + user_id +
                ", plan_name='" + plan_name + '\'' +
                ", start_date=" + start_date +
                ", end_date=" + end_date +
                ", daily_calories=" + daily_calories +
                ", description='" + description + '\'' +
                '}';
    }

    // hashCode和equals方法
    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        DietPlans that = (DietPlans) o;
        return plan_id != null && plan_id.equals(that.plan_id);
    }

    @Override
    public int hashCode() {
        return plan_id != null ? plan_id.hashCode() : 0;
    }
}